package com.rchat.pocmini.activity.searchgroup;

import com.airtalkee.sdk.AirtalkeeAccount;
import com.aso.common.http.delegate.HttpCallbackImpl;
import com.aso.common.http.utils.HttpUtils;
import com.rchat.pocmini.global.HttpCodeGlobal;
import com.rchat.pocmini.global.RequestParam;
import com.rchat.pocmini.global.UrlsGlobal;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by ljd on 2017/7/31.
 */

public class SearchGroupModelImpl implements SearchGroupContract.Model {

    @Override
    public void searchGroup(String groupName, HttpCallbackImpl callback) {
        Map<String, String> param = new HashMap<>();
        param.put("groupId", groupName);
        param.put("account", AirtalkeeAccount.getInstance().getUserId());
        param.put("groupName", groupName);
        //body = {"code":1022,"data":{"platform":1,"version":"1.0","enterprise":1,"groupId":"20040","groupName":"20040","account":"111110000118"}}
        String body = RequestParam.requestRootParam(HttpCodeGlobal.REQ_CODE_1022, param);
        HttpUtils.postAsyn(UrlsGlobal.getUrl(UrlsGlobal.SEARCH_GROUP_URL), body, callback);
    }
}
